﻿using System;
using System.ComponentModel.Composition;
using System.Windows.Forms;

using NRadioTray.Interface;

namespace NRadioTray.Plugin.MR
{
    [Export(typeof(IPlugin))]
    public class MRPlugin : IPlugin, IDisposable
    {
        private MrPluginView view;
        
        private MrPluginPresenter presenter;

        /// <summary>
        /// Gets the handler.
        /// </summary>
        public Guid Handler
        {
            get
            {
                return Guid.Parse("A2C4B22F-B42A-4042-AFFD-516749D4CE24");
            }
        }

        /// <summary>
        /// Gets the name.
        /// </summary>
        public string Name
        {
            get
            {
                return "Muzyczne Radio HotMix";
            }
        }

        /// <summary>
        /// Runs this instance.
        /// </summary>
        public void Run()
        {
            this.Initialize();
            this.Activate();

        }

        /// <summary>
        /// Activates this instance.
        /// </summary>
        private void Activate()
        {
            this.view.Show();
        }

        /// <summary>
        /// Initializes this instance.
        /// </summary>
        private void Initialize()
        {
            this.view = new MrPluginView();
            this.view.Text = this.Name;
            this.presenter = new MrPluginPresenter(this.view);
        }

        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        public void Dispose()
        {
            this.view.Dispose();
        }
    }
}
